/* window creation using OpenGL
** base code from nehe.gamedev.net
*/

#ifndef _GLWINDOW_H
#define _GLWINDOW_H

#include <windows.h>

class GL_Window
{
public:
	GL_Window();
	// create OpenGL window
	bool create(const char* title, bool fullScreen, const char* className, HINSTANCE hInstance, LPVOID lpParam);
	// destroy OpenGL window
	void destroy();	
	bool changeScreenResolution();
	void reshapeGL();
	// double buffering
	void swapBuffers() {::SwapBuffers(m_hDC);}
	void setPosX(int x);
	// for use with WORD parameter
	void setPosX(unsigned short x) {setPosX((int)x);}  
	void setPosY(int y);
	// for use with WORD parameter
	void setPosY(unsigned short y) {setPosY((int)y);}  
	int getPosX();
	int getPosY();
	void setWidth(int width);
	void setHeight(int height);	
	int getWidth();
	int getHeight();	
	void setHiColor() {m_bitsPerPixel=16;}
	void setTrueColor() {m_bitsPerPixel=32;}
	// class conversion operator for window handle ( GL_Window can be used as a window handle)
	operator HWND() {return m_hWnd;}

private:
	HWND m_hWnd;		// window handle
	HDC m_hDC;			// device context
	HGLRC m_hRC;		// rendering context
	int m_windowPosX;
	int m_windowPosY;
	int m_windowWidth;
	int m_windowHeight;
	int m_screenWidth;
	int m_screenHeight;
	int m_bitsPerPixel;
	bool m_isFullScreen;
};

#endif